home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 49
/
Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso
/
-serious-
/
comms
/
other
/
novia
/
src
/
api
/
novia_io_api.c
< prev
next >
Wrap
Text File
|
1999-12-06
|
22KB
|
884 lines
#include <novia/novia_global.h>
#include <novia/novia_misc.h>
#include <pragma/intuition_lib.h>
#include <pragma/gadtools_lib.h>
#include <pragma/exec_lib.h>
#include <pragma/dos_lib.h>
#include <intuition/intuition.h>
#include <novia/novia_funcs.h>
#include <novia/novia_registers.h>
#include <pragma/noviasys_lib.h>
#define DEBUG
extern MainPortConfig *mainportconfig;
__saveds ASM void nslib_ShowText(REG(a0) char *path);
__saveds ASM void nslib_ShowPart(REG(a0) char *path, REG(d0) long startseek, REG(d1) long size);
__saveds ASM void nslib_SystemMessage(REG(a0) char *text);
__saveds ASM void nslib_SetColor(REG(d0) char newcolor);
__saveds ASM void nslib_SetBColor(REG(d0) char newcolor);
__saveds ASM void nslib_space(REG(d0) char wert);
__saveds ASM void nslib_cleft(REG(d0) char wert);
__saveds ASM void nslib_cright(REG(d0) char wert);
__saveds ASM void nslib_LF();
__saveds ASM char nslib_Getstring(REG(a0) char *bp, REG(a1) char *src, REG(d0) char maxlen, REG(d1) ULONG flags, REG(d2) ULONG sigs);
__saveds ASM char nslib_Getbyte(REG(a0) UBYTE *p, REG(a1) UBYTE *source, REG(d0) char max, REG(d1) ULONG flags, REG(d2) ULONG sigs);
__saveds ASM char nslib_Getword(REG(a0) UWORD *p, REG(a1) UWORD *source, REG(d0) char max, REG(d1) ULONG flags, REG(d2) ULONG sigs);
__saveds ASM char nslib_Getlong(REG(a0) ULONG *p, REG(a1) ULONG *source, REG(d0) char max, REG(d1) ULONG flags, REG(d2) ULONG sigs);
__saveds ASM void nslib_Writeio(REG(a0) char *string, REG(d0) ULONG len);
__saveds ASM void nslib_Writelong(REG(d0) ULONG tolong);
__saveds ASM void nslib_CSI(REG(d0) char csi);
__saveds ASM void nslib_JumpXY(REG(d0) char x, REG(d1) char y);
__saveds ASM void nslib_CLS();
__saveds ASM char nslib_Getline(REG(a0) char *bp, REG(a1) char *src, REG(d0) char maxlen, REG(d1) ULONG flags, REG(d2) ULONG sigs);
__saveds ASM char nslib_Yesno(REG(d0) BOOL vorgabe,REG(d1) ULONG sigs);
__saveds ASM char nslib_AskKey( register __d0 BOOL vorgabe, register __d1 ULONG flags, register __d2 ULONG sigs);
__saveds ASM char nslib_GetChar(REG(a0) char *vorgabe, REG(d0) ULONG sigs);
__saveds ASM char nslib_WaitKey(REG(d0) ULONG sigs);
__saveds ASM void nslib_ChangeScreenStatus(REG(a0) char *string);
__saveds ASM void nslib_ErrorMessage(REG(a0) char *string);
__saveds ASM void nslib_GetCurserPos();
__saveds ASM void nslib_FreeMsg(REG(a0) message *msg);
__saveds ASM void nslib_ReturnMsg(REG(a0) message *msg);
__saveds ASM void nslib_ClearIOBuffer();
__saveds ASM void nslib_vioprintf(REG(a0) char *formatstring, REG(a1) char *args);
__saveds ASM void nslib_PrintDosError(REG(d0) const LONG errorcode);
extern struct Task *startrexxprg(char *ProgramName);
extern LONG SN_Send(APTR data, ULONG len);
extern struct Library *NoviaSysBase;
__saveds ASM void nslib_ShowText(REG(a0) char *path)
{
LONG size;
char *buffer;
BPTR mulder;
if ((mulder = Open(path, MODE_OLDFILE)))
{
Seek(mulder, 0, OFFSET_END);
size = Seek(mulder, 0, OFFSET_END);
Seek(mulder, 0, OFFSET_BEGINNING);
if ((buffer = AllocVec((ULONG)size + 1, MEMF_ANY | MEMF_CLEAR)))
{
Read(mulder, buffer, size);
ioprintf(buffer, size);
FreeVec(buffer);
}
else
{
ioprintf("Can't alloc mem for textbuffer\n");
}
Close(mulder);
}
else
{
ioprintf("Can't open %s.\n",path);
}
}
__saveds ASM void nslib_ShowPart(REG(a0) char *path, REG(d0) long startseek, REG(d1) long size)
{
char *buffer;
BPTR mulder;
if ((mulder=Open(path,MODE_OLDFILE)))
{
Seek(mulder,startseek,OFFSET_BEGINNING);
if ((buffer=AllocVec((ULONG)size+1,MEMF_ANY)))
{
Read(mulder,buffer,size-1);
nslib_Writeio(buffer,size-1);
FreeVec(buffer);
}
Close(mulder);
}
else
{
ioprintf("Can't open %s.",(char *)path);
}
}
__saveds ASM void nslib_SystemMessage(REG(a0) char *text)
{
struct PortData *cport=(PortData *)FindTask(NULL)->tc_UserData;
if (cport)
{
char oldcolor=cport->color;
char oldbcolor=cport->bcolor;
ioprintf("c7z0%s%c%dz%d\n",text,oldcolor,oldbcolor);
}
}
__saveds ASM void nslib_SetColor(REG(d0) char newcolor)
{
struct PortData *cport=(PortData *)FindTask(NULL)->tc_UserData;
if (cport)
{
char buffer[10];
char iocounter=0;
cport->color=newcolor;
buffer[iocounter++]=27; // CSI
buffer[iocounter++]=91; // [
buffer[iocounter++]=51; // 3
buffer[iocounter++]=newcolor+48;
buffer[iocounter++]=109; // m
buffer[iocounter]=0;
nslib_Writeio(buffer,-1);
}
}
__saveds ASM void nslib_SetBColor(REG(d0) char newcolor)
{
struct PortData *cport=(PortData *)FindTask(NULL)->tc_UserData;
if (cport)
{
char buffer[10];
char iocounter=0;
cport->bcolor=newcolor;
buffer[iocounter++]=27; // CSI
buffer[iocounter++]=91; // [
buffer[iocounter++]=52; // 4
buffer[iocounter++]=newcolor+48;
buffer[iocounter++]=109; // m
buffer[iocounter]=0;
nslib_Writeio(buffer,-1);
}
}
__saveds ASM void nslib_space(REG(d0) char wert)
{
char test[100],i;
if (wert>0)
{
for (i=0;i<100;i++)test[i]=32;
nslib_Writeio(test,wert);
}
}
__saveds ASM void nslib_cleft(REG(d0) char wert)
{
if (wert>0)
ioprintf("%dD",wert);
}
__saveds ASM void nslib_cright(REG(d0) char wert)
{
char test[10];
if (wert>0)
{
sprintf(test,"%dC",wert);
nslib_Writeio(test,-1);
}
}
__saveds ASM void nslib_LF()
{
nslib_Writeio("\n",1);
}
__saveds ASM char nslib_Getstring(REG(a0) char *bp, REG(a1) char *src, REG(d0) char maxlen, REG(d1) ULONG flags, REG(d2) ULONG sigs)
{
return nslib_Getline(bp,src,maxlen,flags,sigs);
}
__saveds ASM char nslib_Getbyte(REG(a0) UBYTE *p, REG(a1) UBYTE *source, REG(d0) char max, REG(d1) ULONG flags, REG(d2) ULONG sigs)
{
char buffer1[10];
char buffer2[10];
char returncode;
ULONG ulong;
sprintf(buffer1,"%d",*source);
returncode=nslib_Getline(buffer2,buffer1,max,(INPUT_TYPE_NUMBER | flags),sigs);
StrToLong(buffer2,(LONG *)&ulong);
p[0]=(UBYTE)ulong;
return returncode;
}
__saveds ASM char nslib_Getword(REG(a0) UWORD *p, REG(a1) UWORD *source, REG(d0) char max, REG(d1) ULONG flags, REG(d2) ULONG sigs)
{
char buffer1[15];
char buffer2[15];
char returncode;
ULONG ulong;
sprintf(buffer1,"%d",*source);
returncode=nslib_Getline(buffer2,buffer1,max,(INPUT_TYPE_NUMBER | flags),sigs);
StrToLong(buffer2,(LONG *)&ulong);
p[0]=(UWORD)ulong;
return returncode;
}
__saveds ASM char nslib_Getlong(REG(a0) ULONG *p, REG(a1) ULONG *source, REG(d0) char max, REG(d1) ULONG flags, REG(d2) ULONG sigs)
{
char buffer1[20];
char buffer2[20];
char returncode;
sprintf(buffer1,"%d",*source);
returncode=nslib_Getline(buffer2,buffer1,max,(INPUT_TYPE_NUMBER | flags),sigs);
StrToLong(buffer2,(LONG *)p);
return returncode;
}
__saveds ASM void nslib_Writeio(REG(a0) char *string, REG(d0) ULONG len)
{
struct PortData *cport=(PortData *)FindTask(NULL)->tc_UserData;
if (cport)
{
char *iobuffer=cport->iobuffer;
long counter=0,iocounter=0,ulong,length,chars;
IOBuffer *io_entry;
for (counter=0; (string[counter]!=0 && counter<len) ; counter++)
{
if (string[counter]==25) // MCI Controlcode CTRL-Y
{
if (string[counter+1]>96 && string[counter+1]<123) // convert to upper
string[counter+1]=string[counter+1]-32;
switch(string[counter+1])
{
case 'C': // C (set color)
iobuffer[iocounter++]=27; // CSI
iobuffer[iocounter++]=91; // [
iobuffer[iocounter++]=51; // 3
iobuffer[iocounter++]=string[counter+2];// char
iobuffer[iocounter++]=109; // m
counter=counter+2;
cport->color=string[counter]-48;
break;
case 'Z': // Z (set backgroundcolor)
iobuffer[iocounter++]=27; // CSI
iobuffer[iocounter++]=91; // [
iobuffer[iocounter++]=52; // 4
iobuffer[iocounter++]=string[counter+2];// char
iobuffer[iocounter++]=109; // m
counter=counter+2;
cport->bcolor=string[counter]-48;
break;
case 'V': // V (Show Variable)
// Examples: VL003 or VLHandle - Show LocalUser Handle
// VE003 or VEHandle - Show EditUser Handle
// VM006 Show GMT-Time
// !!! DIRECT NAMES ARE NOT IMPLEMENTED IN THIS VERSION !!!
//
chars=StrToLong(&string[counter+3],(LONG *)&ulong);
if (ulong>0 && ulong<=*cport->numberofmci)
{
char *offset;
if (string[counter+2]>96 && string[counter+2]<123) // convert to upper
string[counter+2]=string[counter+2]-32;
if (string[counter+2]=='U')
offset=(char *)&cport->LocalUser;
else
offset=(char *)&cport->EditUser;
switch (cport->mcicmd[ulong].type)
{
case TYPE_BYTE:
sprintf(iobuffer+iocounter,"%d",offset[cport->mcicmd[ulong].offset]);
length=strlen(iobuffer+iocounter);
if (length>0)iocounter=iocounter+length;
break;
case TYPE_WORD:
sprintf(iobuffer+iocounter,"%d",((WORD *)offset)[cport->mcicmd[ulong].offset>>1]);
length=strlen(iobuffer+iocounter);
if (length>0)iocounter=iocounter+length;
break;
case TYPE_LONG:
sprintf(iobuffer+iocounter,"%d",((long *)offset)[cport->mcicmd[ulong].offset>>2]);
length=strlen(iobuffer+iocounter);
if (length>0)iocounter=iocounter+length;
break;
case TYPE_STRING:
sprintf(&iobuffer[iocounter],"%s",offset+cport->mcicmd[ulong].offset);
length=strlen(offset+cport->mcicmd[ulong].offset);
if (length>0)iocounter=iocounter+length;
break;
}
}
if (chars<0)chars=0;
counter=counter+2+chars;
break;
case 'N': // N (Print n Lines)
iobuffer[iocounter++]=27; // CSI
iobuffer[iocounter++]=91; // [
iobuffer[iocounter++]=10; // LineFeed
counter=counter+2;
break;
/* case 'R': run a Program
1 - start a internal novia command
2 - start a DOS-Exec-Program
3 - start a NOVIA-Executable (Plugin & PLAY)
4 - start a NOVIA-AREXX-Script
5 - start a "CNETC", Executable
6 - start a CNET-AREXX
Example: 3rexxc:wall.rexx start the wall in rexxc:
switch(iobuffer[iocounter+2])
{
buffer2[100];
for (ulong=0;((ulong<90) && (!(iobuffer[iocounter+3+ulong]==')')));ulong++)
buffer2[ulong]=iobuffer[iocounter+3+ulong];
buffer2[ulong]=0;
case 1:
GetArg(buffer2);
if (!StdCommand(GetCommandID(argstring[0])))
ioprintf("error: unknown command %s\n",buffer2);
break;
case 2:
break;
case 3:
#ifdef DEBUG
printf("RUN REXX: %d",buffer2);
#endif
break;
case 4:
break;
case 5:
break;
case 6:
break;
}*/
case 'T': // Print a textfile
break;
}
}
else
{
if (string[counter] == 9) // FORWARD-TAB
{
/* iobuffer[iocounter++] = ' ';
iobuffer[iocounter++] = ' ';*/
iobuffer[iocounter] = ' ';
}
else
iobuffer[iocounter]=string[counter];
iocounter++;
}
}
iobuffer[iocounter]=0;
if (cport->win)
{
cport->ConWrite->io_Data = iobuffer;
cport->ConWrite->io_Length = iocounter;
cport->ConWrite->io_Command = CMD_WRITE;
DoIO((IORequest *)cport->ConWrite);
}
// if (cport->network.isopen && cport->network.can_write && cport->network.online)
// SN_Send(iobuffer, iocounter);
}
}
__saveds ASM void nslib_Writelong(REG(d0) ULONG tolong)
{
char buffer[15];
sprintf(buffer,"%d",tolong);
nslib_Writeio(buffer,-1);
}
__saveds ASM void nslib_CSI(REG(d0) char csi)
{
char *buffer=" ";
buffer[1]=csi;
nslib_Writeio(buffer,1);
}
__saveds ASM void nslib_JumpXY(REG(d0) char x, REG(d1) char y)
{
char buffer[10];
sprintf(buffer,"%d;%dH",y,x);
nslib_Writeio(buffer,-1);
}
__saveds ASM void nslib_CLS()
{
nslib_Writeio("H
",-1); // erase the screen
}
__saveds ASM char nslib_Getline(REG(a0) char *bp, REG(a1) char *src, REG(d0) char maxlen, REG(d1) ULONG flags, REG(d2) ULONG sigs)
{
struct PortData *cport=(PortData *)FindTask(NULL)->tc_UserData;
if (cport)
{
char cp[80];
char bp2[80];
char pos=0;
char end=0;
BOOL Quit=FALSE;
BOOL habschon;
BOOL change=FALSE;
int i;
char wert;
short counter;
List *his_list=(List *)&cport->his_list;
struct HisEntry *hisentry=(HisEntry *)his_list->lh_TailPred;
BOOL first=FALSE;
BOOL ende=FALSE;
*bp=0;
nslib_Writeio("c3",-1);
if (src!=0)
{
strcpy(bp,src);
end=strlen(bp);
nslib_Writeio(bp,-1);
pos=end;
}
bp[end]=0;
while(!Quit && cport->network.online)
{
habschon=FALSE;
Conread(cp,1,sigs);
if (*cp==13)
{
*cp=10;
nslib_Writeio(cp,1);
if ((flags & BUFFERED) && end)
{
if (cport->hiscounter<50)
cport->hiscounter++;
else
{
FreeVec(RemHead(his_list));
}
if (hisentry=AllocVec(sizeof(HisEntry),MEMF_ANY|MEMF_CLEAR))
{
strncpy(hisentry->buffer,bp,80);
AddTail(his_list,(Node *)hisentry);
}
}
Quit=TRUE;
}
if (*cp==9 && (flags & TAB_FORWARD))
return TAB_FORWARD;
if (*cp==-101)
{
Conread(cp,1,sigs);
switch (*cp)
{
case 'Z': // TAB-Backward
if (flags & TAB_BACKWARD)
return TAB_BACKWARD;
break;
case 'D':
if (pos>0)
{
nslib_Writeio("D",-1);
pos--;
}
break;
case 'C':
if (pos<end && end<=maxlen)
{
nslib_Writeio("C",-1);
pos++;
}
break;
case 'A':
if (flags & CURSER_BREAK)
{
return ESC_UP;
}
else if (flags & BUFFERED)
{
if (hisentry && hisentry->ln_Succ && hisentry->ln_Pred)
{
nslib_cleft(pos);
nslib_space(end);
nslib_cleft(end);
if (first)
{
if (hisentry->ln_Pred->ln_Pred)
{
hisentry=hisentry->ln_Pred;
strcpy(bp,hisentry->buffer);
end=strlen(bp);
nslib_Writeio(bp,-1);
pos=end;
}
else
{
ClearMemQuick(bp,80);
end=0;
pos=0;
ende=TRUE;
}
}
else
{
strcpy(bp,hisentry->buffer);
end=strlen(bp);
nslib_Writeio(bp,-1);
pos=end;
first=TRUE;
}
}
}
break;
case 'B':
if (flags & CURSER_BREAK)
return ESC_DOWN;
else if (flags & BUFFERED)
{
if (hisentry && hisentry->ln_Succ && hisentry->ln_Pred)
{
nslib_cleft(pos);
nslib_space(end);
nslib_cleft(end);
if (ende)
{
strcpy(bp,hisentry->buffer);
end=strlen(bp);
nslib_Writeio(bp,-1);
pos=end;
first=TRUE;
ende=FALSE;
}
else
{
if (hisentry->ln_Succ->ln_Succ)
{
hisentry=hisentry->ln_Succ;
strcpy(bp,hisentry->buffer);
end=strlen(bp);
nslib_Writeio(bp,-1);
pos=end;
}
else
{
ClearMemQuick(bp,80);
end=0;
pos=0;
first=FALSE;
}
}
}
}
break;
}
habschon=TRUE;
change=TRUE;
}
if (*cp==8 && pos>0 && habschon==FALSE)
{
nslib_Writeio(cp,1);
pos--;
for (i=pos;i<end;i++)
{
bp[i]=bp[i+1];
}
end--;
nslib_Writeio(&bp[pos],end-pos);
nslib_Writeio(" ",1);
nslib_cleft((end-pos)+1);
habschon=TRUE;
change=TRUE;
}
if (*cp==127 && pos<end && habschon==FALSE)
{
for (i=pos;i<end;i++)
{
bp[i]=bp[i+1];
}
end--;
nslib_Writeio(&bp[pos],end-pos);
nslib_Writeio(" ",1);
nslib_cleft((end-pos)+1);
habschon=TRUE;
change=TRUE;
}
if (((*cp>=-96 && *cp<0) | (*cp>=32 && *cp<127)) && end<maxlen && pos<maxlen && habschon==FALSE)
{
if ((!(flags & INPUT_TYPE_NUMBER))| (*cp>47 && *cp<58))
{
if (pos==end)
{
if (change==FALSE && pos>0)
{
nslib_cleft(pos);
nslib_space(end);
nslib_cleft(end);
pos=1;
end=1;
bp[1]=0;
bp[0]=*cp;
nslib_Writeio(cp,1);
}
else
{
nslib_Writeio(cp,1);
bp[pos]=*cp;
pos++;
end++;
bp[end]=0;
}
}
else
{
for (i=end;i>=pos;i--)
{
bp[i+1]=bp[i];
}
end++;
bp[pos]=*cp;
bp[end]=0;
ioprintf("%dCP%dD@%c",end-pos,end-pos,*cp);
pos++;
}
change=TRUE;
habschon=TRUE;
bp[end]=0;
}
}
if (pos==0 && end==0 && (flags & CURSER_BREAK))Quit=TRUE;
}
bp[end]=0;
bp[end+1]=0;
if (flags & BUFFERED)
{
}
}
else
return NULL;
}
__saveds ASM char nslib_Yesno(REG(d0) BOOL vorgabe,REG(d1) ULONG sigs)
{
struct PortData *cport=(PortData *)FindTask(NULL)->tc_UserData;
if (cport)
{
char Quit=FALSE;
char buffer[10];
if (vorgabe==TRUE)nslib_Writeio("
[
Yes
]
",-1);
if (vorgabe==FALSE)nslib_Writeio("
[
No
]
",-1);
while (!Quit && cport->network.online)
{
Conread(buffer,1,sigs);
if (*buffer==89 | *buffer==121) // ASCII Y & y
{
nslib_Writeio("Yes\n",-1);
return TRUE;
}
if (*buffer==78 | *buffer==110) // ASCII N & n
{
nslib_Writeio("No\n",-1);
return FALSE;
}
if (*buffer==13 | *buffer==0)
{
if (vorgabe==TRUE)
{
nslib_Writeio("Yes\n",-1);
return TRUE;
}
if (vorgabe==FALSE)
{
nslib_Writeio("No\n",-1);
return FALSE;
}
}
}
}
}
__saveds ASM char nslib_AskKey( register __d0 BOOL vorgabe, register __d1 ULONG flags, register __d2 ULONG sigs)
{
struct PortData *cport=(PortData *)FindTask(NULL)->tc_UserData;
char result = 0;
char buffer[10];
if (cport && flags)
{
while (!result && cport->network.online)
{
Conread(buffer,1,sigs);
if ((*buffer=='Y' | *buffer=='y') && (flags & FLAG_YES))
{
nslib_Writeio("Yes\n",-1);
result = RESULT_YES;
}
if ((*buffer=='N' | *buffer=='n') && (flags & FLAG_NO))
{
nslib_Writeio("No\n",-1);
result = RESULT_NO;
}
if ((*buffer=='A' | *buffer=='a') && (flags & FLAG_ALL))
{
nslib_Writeio("All\n",-1);
result = RESULT_ALL;
}
if ((*buffer=='C' | *buffer=='c') && (flags & FLAG_CANCEL))
{
nslib_Writeio("Cancel\n",-1);
result = RESULT_CANCEL;
}
if ((*buffer=='Q' | *buffer=='q') && (flags & FLAG_QUIT))
{
nslib_Writeio("Quit\n",-1);
result = RESULT_QUIT;
}
if (*buffer==13 | *buffer==10)
{
if (vorgabe)
{
switch(vorgabe)
{
case RESULT_YES:
nslib_Writeio("Yes\n",-1);
result = RESULT_YES;
break;
case RESULT_NO:
nslib_Writeio("No\n",-1);
result = RESULT_NO;
break;
case RESULT_ALL:
nslib_Writeio("Yes\n",-1);
result = RESULT_ALL;
break;
case RESULT_CANCEL:
nslib_Writeio("Cancel\n",-1);
result = RESULT_CANCEL;
break;
case RESULT_QUIT:
nslib_Writeio("Quit\n",-1);
result = RESULT_QUIT;
break;
}
}
}
}
}
return result;
}
__saveds ASM char nslib_GetChar(REG(a0) char *vorgabe, REG(d0) ULONG sigs)
{
struct PortData *cport=(PortData *)FindTask(NULL)->tc_UserData;
if (cport)
{
char buffer[10];
while (cport->network.online)
{
Conread(buffer,1,sigs);
if (*buffer==13) return *vorgabe;
if (*buffer)return *buffer;
}
}
return FALSE;
}
__saveds ASM char nslib_WaitKey(REG(d0) ULONG sigs)
{
char buffer[10];
Conread(buffer,1,sigs);
return NULL;
}
__saveds ASM void nslib_ChangeScreenStatus(REG(a0) char *string)
{
/* strcpy(screentitel+titellen,string);
if (win)
{
SetWindowTitles(win,NULL,screentitel);
}*/
}
__saveds ASM void nslib_ErrorMessage(REG(a0) char *string)
{
nslib_Writeio(string,-1);
VPrintf(string,0);
VPrintf("\n",0);
};
__saveds ASM void nslib_GetCurserPos()
{
struct PortData *cport=(PortData *)FindTask(NULL)->tc_UserData;
if (cport)
{
long *longbuffer;
char bp[5];
char cp[10];
char pos=0;
BOOL Quit=FALSE;
*bp=0;
nslib_Writeio("n",-1);
while(!Quit && cport->network.online)
{
Conread(cp,1,0);
if (*cp==82)Quit=TRUE;
if ((*cp>=-96 && *cp<0) | (*cp>=32 && *cp<127))
{
nslib_Writeio(cp,1);
bp[pos]=*cp;
pos++;
}
}
bp[pos+1]=0;
StrToLong((STRPTR)bp,longbuffer);
cport->CurserY=(char)*longbuffer;
if (cport->CurserY<10)
{
StrToLong((STRPTR)&bp[2],longbuffer);
cport->CurserX=(char)*longbuffer;
}
else
{
StrToLong((STRPTR)&bp[3],longbuffer);
cport->CurserX=(char)*longbuffer;
}
}
}
__saveds ASM void nslib_FreeMsg(REG(a0) message *msg)
{
/* if (msg->ln_Succ)
{
msg->ln_Succ->ln_Pred=msg->ln_Pred;
}
else
{
msg_list->last=msg->ln_Pred;
}
if (msg->ln_Pred)
{
msg->ln_Pred->ln_Succ=msg->ln_Succ;
}
else
{
msg_list->first=msg->ln_Succ;
}*/
if (msg->data_len>0)MyFreeVec(msg->data,"FREE IO_Global, FreeMsg(), msg->data");
MyFreeVec(msg,"FREE IOGlobal: FreeMsg, msg");
}
__saveds ASM void nslib_ReturnMsg(REG(a0) message *msg)
{
msg->msg_type=MSG_REPLY;
ReplyMsg((Message *)msg);
}
__saveds ASM void nslib_ClearIOBuffer()
{
}
__saveds ASM void nslib_vioprintf(REG(a0) char *formatstring, REG(a1) char *args)
{
char *buffer=AllocVec(10000,MEMF_ANY);
if (buffer)
{
vsprintf(buffer, formatstring, unsigned int(args));
nslib_Writeio(buffer,-1);
FreeVec(buffer);
}
}
__saveds ASM void nslib_PrintDosError(REG(d0) const LONG errorcode)
{
char buffer[FAULT_MAX];
Fault((LONG)errorcode,NULL,buffer,FAULT_MAX);
ioprintf("DOS-Error %d: %s\n",errorcode,buffer);
}
__saveds ASM MainPortConfig * nslib_getmainportconfig()
{
return(mainportconfig);
}